﻿CREATE PROCEDURE dbo.GetFunctions
	(
	@userId int
	)
AS
	select[Functions].FunctionName as Functionname from [Functions]  where [Functions].FunctionId in (
	select b.FunctionId from  [RoleFunctions] b where b.RoleId in(
	select a.UserRole from [UserRoles] a where a.userid = userId))
	FOR XML AUTO, ELEMENTS;
